<?php
/**
 * SearchController.php
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */

/** base class */
require_once 'Madoqua/Controller/Action/Abstract.php';

/** the thing that finds stuff... */
require_once 'Madoqua/Search/Indexer.php';

/** html entities filter */
require_once 'Zend/Filter/HtmlEntities.php';

/**
 * BlogAdmin_SearchController
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */
class BlogAdmin_SearchController extends Madoqua_Controller_Action_Abstract 
{
    /**
     * searching and finding stuff is fun!
     */
    public function indexAction()
    {
        $filter = new Zend_Filter_HtmlEntities(ENT_COMPAT, 'UTF-8');
        //filter
        $query = $filter->filter($this->_getParam('q'));
        //the query
        $this->view->query = $query;
        $this->view->results = Madoqua_Search_Indexer::getIndexer()->find($query);
        //search and pass to view
    }
}